<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=no">
    <title>日新网 - 商讯列表</title>
    <link rel="stylesheet" href="__TMPL__Public/assets/css/bootstrap.min.css">
    <link rel="stylesheet" href="__TMPL__Public/assets/css/reset.css">
    <link rel="stylesheet" href="__TMPL__Public/assets/css/style.css">
    <link rel="stylesheet" href="__PUBLIC__/swiper/swiper.min.css">
    <script type="text/javascript" src="__TMPL__Public/assets/js/rem.js"></script>
    <style>
        body {
            background-color: white!important;
        }
        .tab_nav1 {
            height: .8rem;
            font-size: .28rem;
            color: #000232;
            text-align: center;
            margin-top: .1rem;
            margin-bottom: .20rem;
            width: 100%;
            background-color: #fff;
        }
        .tab_nav1 ul{
            height: .5rem;
            line-height: .5rem;
            padding-top: .24rem;
        }
        .tab_nav1 li {
            float: left;
            padding: 0 .18rem;
        }
        .tab_nav1 .active{color:#c8161d;}
        /*滑块宽度设置*/
        .swiper-slide {
            width: auto;
            text-align: center;
        }
    </style>
</head>
<body>
<!--nav-->
<tc_include file="Public:nav"/>
<!--我的问答页-->
<div class="tab_nav1 swiper-container " id="tab_nav">
    <php>
        $pass       = isset($status_counts['1']) ? $status_counts['1'] : 0;
        $draft      = isset($status_counts['4']) ? $status_counts['4'] : 0;
        $no_pass    = isset($status_counts['2']) ? $status_counts['2'] : 0;
    </php>
    <ul class="comWidth clearfix status_ul swiper-wrapper">
        <li class="swiper-slide">
            <a class="{$cat_id == 0 ? 'active' : ''}" href="{:U('Portal/Businessnews/lists')}">全部</a>
        </li>
        <foreach name="categorys" item="vo">
            <li class="swiper-slide">
                <a class="{$cat_id == $vo['id'] ? 'active' : ''}" href="{:U('Portal/Businessnews/lists',array('cat_id' => $vo['id']))}">{$vo.name}</a>
            </li>
        </foreach>
    </ul>
</div>
<div id="tab_content">
    <div class="tab_content comWidth index_content">
        <volist name="news_lists" id="vo">
            <div class="questions_item ">
                <a href="{:U('Portal/Businessnews/news_detail', ['id' => $vo['id']])}">
                    <p class="text1 ellipsis2">{$vo.post_title}</p>
                </a>
                <p class="text2">
                    <span>{:time_format($vo['post_date'])}</span>
                </p>
            </div>
        </volist>
        <if condition="empty($news_lists)">
            <div style="width: 5rem;height: 3.8rem;position: absolute;top: 50%;left: 50%;margin-top: -1.9rem;margin-left: -2.5rem;">
                <img src="/public/images/img/replace.png" alt="" style="width: 100%;height: auto;">
            </div>
        </if>
    </div>

    <div style="height: .5rem;line-height: .5rem;background-color: #efdddd;" class="js-infinite-scroll-loading text-center">更多</div>
    <div id="nextpage"></div>
</div>

<!--页脚-->
<tc_include file="Public:footer"/>

<script type="text/javascript" src="__TMPL__Public/assets/js/jquery.1.12.4.js"></script>
<script src="__TMPL__Public/assets/js/bootstrap.min.js" ></script>
<script src="__TMPL__Public/assets/js/jquery.infiniteScroll.js"></script>
<script type="text/javascript" src="__PUBLIC__/swiper/swiper.min.js"></script>
<script>
    // 加载更多
    $('#nextpage').infiniteScroll({
        loading:'.js-infinite-scroll-loading',
        total_pages:{$total_pages},
        success:function(content){
            var items = $(content).find('.index_content .question_item');
            if(items.length > 0){
                $('.index_content').append(items);
            }
        }
    });
</script>
<script>

    var mySwiper = new Swiper('.swiper-container', {
        // slidesPerView: 3.5, //头部一行显示多少个 .5表示显示半个
        spaceBetween: 0, //slide之间的距离（单位px）。
        loop: false, //是否可循环
        initialSlide : 0, // 设置为2后，Swiper初始化时activeSlide成了第三个
        slidesPerView: "auto",
        /*设置slider容器能够同时显示的slides数量(carousel模式)。可以设置为number或者 'auto'则自动根据slides的宽度来设定数量。*/
        freeMode: false,
        /*自动贴合*/
        freeModeSticky: true,
        /*自动贴合。*/
        centeredSlides: false,
        /*设定为true时，活动块会居中，而不是默认状态下的居左。*/
        slideToClickedSlide: true,
        /*设置为true则swiping时点击slide会过渡到这个slide。*/
    });
</script>
</body>
</html>